<html>
<head><meta charset="utf-8"><title>default-substs · project-const-generics · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/index.html">project-const-generics</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html">default-substs</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="230000840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230000840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230000840">(Mar 12 2021 at 09:43)</a>:</h4>
<p>looking into changing <code>ty::ConstKind::Unevaluated</code> so that <code>substs</code> are now optional</p>



<a name="230000913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230000913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230000913">(Mar 12 2021 at 09:44)</a>:</h4>
<p>as mentioned in the <a href="#narrow/stream/260443-project-const-generics/topic/meeting.202021-03-09">last meeting</a></p>



<a name="230000968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230000968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230000968">(Mar 12 2021 at 09:44)</a>:</h4>
<p>this means that we have change the way we deal with type flags</p>



<a name="230000983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230000983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230000983">(Mar 12 2021 at 09:44)</a>:</h4>
<p>and visitors in general</p>



<a name="230001107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230001107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230001107">(Mar 12 2021 at 09:45)</a>:</h4>
<p>i first changed the affected type flags from <code>HAS_TY_PARAMS</code> to <code>HAS_GUARANTEED_TY_PARAMS</code></p>



<a name="230001195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230001195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230001195">(Mar 12 2021 at 09:46)</a>:</h4>
<p>which seems reasonable, but there are places which "need" the old <code>HAS_TY_PARAMS</code> behavior and don't just use it as an optimization</p>



<a name="230001262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230001262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230001262">(Mar 12 2021 at 09:46)</a>:</h4>
<p>so, there we have to add a folder/visitor which actually looks into the default substs</p>



<a name="230001358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230001358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230001358">(Mar 12 2021 at 09:47)</a>:</h4>
<p>that requires a <code>tcx</code> which we don't currently have available in some of these places</p>



<a name="230001535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230001535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230001535">(Mar 12 2021 at 09:48)</a>:</h4>
<p>in general, i want visitors and folders to both look into the default substs</p>



<a name="230001584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230001584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230001584">(Mar 12 2021 at 09:49)</a>:</h4>
<p>for <code>TypeFolder</code>s, that's easy because they already need a <code>TyCtxt</code> rn</p>



<a name="230001604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230001604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230001604">(Mar 12 2021 at 09:49)</a>:</h4>
<p>but <code>TypeVisitor</code>s don't currently have one available</p>



<a name="230003224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230003224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230003224">(Mar 12 2021 at 10:02)</a>:</h4>
<p>I don't know whether adding <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/fold/trait.TypeFolder.html#tymethod.tcx">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/fold/trait.TypeFolder.html#tymethod.tcx</a> to <code>TypeVisitor</code> makes sense</p>



<a name="230005134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230005134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230005134">(Mar 12 2021 at 10:17)</a>:</h4>
<p>do you need it in the generic <code>TypeVisitor</code> or just in some concrete ones?</p>



<a name="230005175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230005175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230005175">(Mar 12 2021 at 10:17)</a>:</h4>
<p>ideally in all <code>TypeVisitor</code>s</p>



<a name="230005198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230005198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230005198">(Mar 12 2021 at 10:17)</a>:</h4>
<p>i want it to be the default to look insid of const substs</p>



<a name="230005246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230005246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230005246">(Mar 12 2021 at 10:18)</a>:</h4>
<p>right</p>



<a name="230005270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230005270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230005270">(Mar 12 2021 at 10:18)</a>:</h4>
<p>I think that's totally fine to add then</p>



<a name="230005271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230005271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230005271">(Mar 12 2021 at 10:18)</a>:</h4>
<p>because otherwise it feels like it is easy to accidentally miss something</p>



<a name="230005400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230005400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230005400">(Mar 12 2021 at 10:19)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/260443-project-const-generics/topic/default-substs/near/230005270">said</a>:</p>
<blockquote>
<p>I think that's totally fine to add then</p>
</blockquote>
<p>but it's incredibly annoying :(</p>



<a name="230005418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230005418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230005418">(Mar 12 2021 at 10:19)</a>:</h4>
<p><span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="230005526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230005526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230005526">(Mar 12 2021 at 10:20)</a>:</h4>
<p>yea... a common problem with adding things in hindsight <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>



<a name="230005579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230005579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230005579">(Mar 12 2021 at 10:20)</a>:</h4>
<p>now, the important question</p>



<a name="230005629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230005629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230005629">(Mar 12 2021 at 10:20)</a>:</h4>
<p>move the type visitor methods like <code>needs_subst</code> to <code>TyCtxt</code></p>



<a name="230005640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230005640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230005640">(Mar 12 2021 at 10:21)</a>:</h4>
<p>or add the tcx as a function argument?</p>



<a name="230006822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230006822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230006822">(Mar 12 2021 at 10:31)</a>:</h4>
<p>oof</p>



<a name="230006923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230006923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230006923">(Mar 12 2021 at 10:32)</a>:</h4>
<p>for the first round, add a function argument, but it may be useful to revisit in the future</p>



<a name="230006937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230006937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230006937">(Mar 12 2021 at 10:32)</a>:</h4>
<p>this is all gonna conflict so much with valtrees <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="230006942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230006942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230006942">(Mar 12 2021 at 10:32)</a>:</h4>
<p>and it would be much easier after valtrees</p>



<a name="230007845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230007845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230007845">(Mar 12 2021 at 10:40)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/260443-project-const-generics/topic/default-substs/near/230006937">said</a>:</p>
<blockquote>
<p>this is all gonna conflict so much with valtrees <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>
</blockquote>
<p>why that <span aria-label="shock" class="emoji emoji-1f628" role="img" title="shock">:shock:</span></p>



<a name="230008100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230008100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230008100">(Mar 12 2021 at 10:42)</a>:</h4>
<p>because of all the changes I had to do around unevaluated constants</p>



<a name="230008111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230008111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230008111">(Mar 12 2021 at 10:42)</a>:</h4>
<p>it's not gonna conflict in a bad way, just in a lot of places</p>



<a name="230008164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230008164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230008164">(Mar 12 2021 at 10:43)</a>:</h4>
<p>uh, i hope it won't be too bad <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="230168491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230168491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230168491">(Mar 13 2021 at 15:12)</a>:</h4>
<p>wasn't too bad <span aria-label="sparkles" class="emoji emoji-2728" role="img" title="sparkles">:sparkles:</span> realized that we can just <code>panic!</code> in some visitors instead of supplying a tcx: <a href="https://github.com/rust-lang/rust/issues/83086">#83086</a></p>



<a name="230168947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230168947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230168947">(Mar 13 2021 at 15:22)</a>:</h4>
<p>yea, the PR looks good. If it's not painful to rebase, merging it with the actual PR sounds like the best plan, but I'd be fine just merging it as a preparatory PR to make the actual PR easier</p>



<a name="230505897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230505897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230505897">(Mar 16 2021 at 12:50)</a>:</h4>
<p>going to merge it with the actual pr</p>



<a name="230525085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230525085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230525085">(Mar 16 2021 at 14:48)</a>:</h4>
<p>I'm catching up here</p>



<a name="230525115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/default-substs/near/230525115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/default-substs.html#230525115">(Mar 16 2021 at 14:48)</a>:</h4>
<p>I can skim the PR</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>